//
//  ZXDropMenuView.h
//  ZXDropMenuViewDemo
//
//  Created by LIUKUN-PC on 16/5/6.
//  Copyright © 2016年 liukun. All rights reserved.
//  原视图为 LrdSuperMenu
//
//

#import <UIKit/UIKit.h>

@interface ZXIndexPath : NSObject

/** 行 */
@property (nonatomic, assign) NSInteger row;
/** 列 */
@property (nonatomic, assign) NSInteger column;
/** item */
@property (nonatomic, assign) NSInteger item;

- (instancetype)initWithColumn:(NSInteger)column row:(NSInteger)row;

+ (instancetype)indexPathWithColumn:(NSInteger)column row:(NSInteger)row;
+ (instancetype)indexPathWithColumn:(NSInteger)column row:(NSInteger)row item:(NSInteger)item;

@end

@class ZXDropMenuView;

@protocol ZXDropMenuViewDataSource <NSObject>

@required
//每个column有多少行
- (NSInteger)menu:(ZXDropMenuView *)menu numberOfRowsInColumn:(NSInteger)column;
//每个column中每行的title
- (NSString *)menu:(ZXDropMenuView *)menu titleForRowAtIndexPath:(ZXIndexPath *)indexPath;

@optional
//有多少个column，默认为1列
- (NSInteger)numberOfColumnsInMenu:(ZXDropMenuView *)menu;
//第column列，没行的image
- (NSString *)menu:(ZXDropMenuView *)menu imageNameForRowAtIndexPath:(ZXIndexPath *)indexPath;
//detail text
- (NSString *)menu:(ZXDropMenuView *)menu detailTextForRowAtIndexPath:(ZXIndexPath *)indexPath;

//某列的某行item的数量，如果有，则说明有二级菜单，反之亦然
- (NSInteger)menu:(ZXDropMenuView *)menu numberOfItemsInRow:(NSInteger)row inColumn:(NSInteger)column;

//如果有二级菜单，则实现下列协议
//二级菜单的标题
- (NSString *)menu:(ZXDropMenuView *)menu titleForItemsInRowAtIndexPath:(ZXIndexPath *)indexPath;
//二级菜单的image
- (NSString *)menu:(ZXDropMenuView *)menu imageForItemsInRowAtIndexPath:(ZXIndexPath *)indexPath;
//二级菜单的detail text
- (NSString *)menu:(ZXDropMenuView *)menu detailTextForItemsInRowAtIndexPath:(ZXIndexPath *)indexPath;
@end

#pragma mark - delegate
@protocol ZXDropMenuViewDelegate <NSObject>

@optional
//点击
- (void)menu:(ZXDropMenuView *)menu didSelectRowAtIndexPath:(ZXIndexPath *)indexPath;

@end

@interface ZXDropMenuView : UIView

@property (nonatomic, weak) id<ZXDropMenuViewDelegate> delegate;
@property (nonatomic, weak) id<ZXDropMenuViewDataSource> dataSource;

@property (nonatomic, strong) UIColor *textColor;
@property (nonatomic, strong) UIColor *selectedTextColor;
@property (nonatomic, strong) UIColor *detailTextColor;
@property (nonatomic, strong) UIColor *indicatorColor;
@property (nonatomic, strong) UIFont *detailTextFont;
@property (nonatomic, strong) UIColor *separatorColor;
@property (nonatomic, assign) NSInteger fontSize;

/** title layers CATextLayer类型 */
@property (nonatomic, copy, readonly) NSArray *titles;

//当前选中的列
@property (nonatomic, strong) NSMutableArray *currentSelectedRows;
//当有二级列表的时候，是否调用点击代理方法
@property (nonatomic, assign) BOOL isClickHaveItemValid;
//当选中二级列表中的Item时，是否显示Row的标题
@property (nonatomic, assign) BOOL isShowRowTitleWhenItemSelected;

//获取title
- (NSString *)titleForRowAtIndexPath:(ZXIndexPath *)indexPath;
//菜单切换，选中的indexPath
- (void)selectIndexPath:(ZXIndexPath *)indexPath;
//默认选中
- (void)selectDeafultIndexPath;
//数据重载
- (void)reloadData;

//初始化后修改Frame无效

@end

